home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d19
/
prowho15.arc
/
PROWHO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-11-09
|
4KB
|
172 lines
(*
* ProWho.PAS - Door to answer the question: Who uploaded that file?
*
* (C) 1988 Samuel H, Smith (05-Feb-88)
*
* revision history:
* 2-19-88 initial coding
*
*)
{$M 12000,20000,20000} {Stack, minheap, maxheap}
{$L-} {Don't link in ram}
{$T+} {Make mapfile}
{$V-} {Relax string rules}
Program WhoUploaded;
{$i prokit.inc} {include standard 'uses' statement}
const
version = 'ProWho v1.5, 10-08-88 (C)1988 S.H.Smith';
shortest = 3; {shortest search key allowed}
var
buffer: array[1..10240] of char;
driver: string; {driver type; taken care of automatically}
download_file: string; {download listing file}
welcome_file: string; {welcome message file}
menu_file: string; {main menu file}
close_file: string; {closing message file}
(* ---------------------------------------------------------------- *)
procedure load_info;
{load the latest configuration file}
var
fd: text;
begin
assignText(fd,config_file);
reset(fd);
readln(fd,driver);
readln(fd,download_file);
readln(fd,welcome_file);
readln(fd,menu_file);
readln(fd,close_file);
close(fd);
end;
(* ---------------------------------------------------------------- *)
procedure locate_file(name: string);
var
fd: text;
line: string;
uline: string;
i: integer;
recs: integer;
downs: integer;
ups: integer;
hits: integer;
begin
AssignText(fd,download_file);
{$i-} reset(fd); {$i+}
if ioresult <> 0 then
begin
displn(RED+'Can''t access data file. Sorry!');
exit;
end;
SetTextBuf(fd,buffer);
downs := 0;
ups := 0;
hits := 0;
recs := 0;
stoupper(name);
make_log_entry('Searching for ('+name+') ...',true);
newline;
while (eof(fd)=false) and (nomore = false) and (dump_user = false) do
begin
inc(recs);
case (recs mod 300) of
1: disp('.');
200: disp(^H' '^H);
end;
readln(fd,line);
uline := line;
stoupper(uline);
i := pos(name,uline);
if i > 0 then
begin
displn(^M+WHITE+copy(line,1,i-1)+
RED +name+
WHITE+copy(line,i+length(name),255));
inc(hits);
if pos('(U)',uline) > 0 then inc(ups);
if pos('(D)',uline) > 0 then inc(downs);
end;
end;
close(fd);
newline;
disp(GREEN+itoa(recs)+' entries scanned, '+itoa(hits)+' matches');
if ups > 0 then disp(', '+itoa(ups)+' uploads');
if downs > 0 then disp(', '+itoa(downs)+' downloads');
displn('.');
newline;
end;
(* ---------------------------------------------------------------- *)
procedure main_menu;
{main procedure}
begin
repeat
force_enter;
display_file(menu_file);
display_time_left;
disp('Enter the Text to Scan for: (Q)=quit? ');
get_cmdline; {get cmdline, map to upper case}
newline;
if cmdline = 'Q' then
exit;
if length(cmdline) < shortest then
displn('Please enter a longer search key!')
else
if is_wild(cmdline) then
displn('Wildcards won''t work! Use keywords only.')
else
locate_file(cmdline);
until dump_user or (minutes_left < 1);
end;
(* ---------------------------------------------------------------- *)
begin {main block}
init; {must be first - opens com port, loads setup and user data}
newline;
displn(version);
load_color_constants('PROCOLOR');
{use 'PROCOLOR' to redefine colors; defaults used
if this file is missing}
progname := 'ProWho'; {program name on status line, must be 7 characters}
load_info; {load info from config file}
display_file(welcome_file);
main_menu;
display_file(close_file);
uninit; {must be last - closes com port and updates database}
end.